package com.iraeta.controller;

import com.alibaba.fastjson.JSON;
import com.iraeta.common.AuthAccess;
import com.iraeta.common.Result;
import com.iraeta.dao.bpm.HrYgdamDao;
import com.iraeta.entity.bpm.HrYgdam;
import com.iraeta.service.oa.RenYuanDangAnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController(value = "TestController")
@RequestMapping("test")
public class TestController extends BaseController{
    @Autowired
    RenYuanDangAnService renYuanDangAnService;
    @Resource
    HrYgdamDao hrYgdamDao;

    @RequestMapping("test1")
    @AuthAccess
    public String test1(){
        renYuanDangAnService.processTongBu();
        return this.success();
    }

    @RequestMapping("test2")
    @AuthAccess
    public String test2(){
        String csfzh = this.getRequest().getParameter("csfzh");
        HrYgdam hrYgdam = hrYgdamDao.selectByIdCard(csfzh);
        if(hrYgdam == null){
            return JSON.toJSONString(Result.error());
        }
        return this.success(hrYgdam);
    }
}
